package singleton.demo1;

public class TestLearn03 {
    private TestLearn03(){}

    private static TestLearn03 INS;

    public static TestLearn03 getInstance(){

        if(null == INS){
            try {
                // 为什么说线程不安全？ 这里线程睡了其它线程进来照样获取因为没有走到下面去。
                Thread.sleep(1);
            }catch (Exception e){
                e.printStackTrace();
            }
            INS = new TestLearn03();
        }

        return INS;
    }
}
